<template>
  <div id="basic">
        <div class="title">团体膳食测评报告</div>
        <div id="createTime">报告日期：{{ report_time }}</div>
        <el-divider  border-style="dashed"  style="border-color:#626aef">
          <div class="subTitle">基本信息</div>
        </el-divider>
        <div class="every">
          <div><span>机关名称：</span><span>{{ formInline.name }}</span></div>
        </div>
        <div class="every">
          <div><span>所在年级：</span><span>{{ formInline.grade }}</span></div>
        </div>
        <div class="every">
          <div><span>总人数：</span><span>{{ formInline.total_number }}</span></div>
        </div>
        <div class="every">
          <div><span>男孩人数：</span><span>{{ formInline.boys_number }}</span></div>
        </div>
        <div class="every">
          <div><span>女孩人数：</span><span>{{ formInline.girls_number }}</span></div>
        </div>
        <div class="every">
          <div><span>详细地址：</span><span>{{ formInline.address }}</span></div>
        </div>
        <div class="every">
          <div><span>联系电话：</span><span>{{ formInline.mobile }}</span></div>
        </div>
        <div class="every">
          <div><span>负责人：</span><span>{{ formInline.cadre }}</span></div>
        </div>
        <div class="every">
          <div><span>园长姓名：</span><span>{{ formInline.principal }}</span></div>
        </div>
        <div class="every">
          <div><span>教师人数：</span><span>{{ formInline.teacher_number }}</span></div>
        </div>

        <el-card class="right-box-card">
          <CompanyChilddietary></CompanyChilddietary>
        </el-card>
        <div style="clear: both"></div>
        <div class="params " style="margin-bottom: 30px;  margin-top: 200px;">
          <div class="shu"></div>
          喂养建议</div>
        <el-input class="elText" v-model="form.elText"  style="width: 85%" type="textarea" clearable ></el-input>
        <div style="clear: both"></div>
        <div class="params " style="margin-bottom: 30px;margin-top: 20px">
          <div class="shu"></div>
          营养建议</div>
        <el-input class="elText" v-model="form.elTextTwo"  style="width: 85%" type="textarea" clearable ></el-input>
        <div style="clear: both"></div>
        <div class="params " style="margin-bottom: 30px;margin-top: 20px">
          <div class="shu"></div>
          医生建议</div>
        <el-input class="elText" v-model="form.elTextThree"  style="width: 85%" type="textarea" clearable ></el-input>

        <div style="clear: both"></div>
        <el-card class="right-box-card">
          <el-divider  border-style="dashed"  style="border-color:#626aef;margin-top: 225px;">
            <div class="subTitle">第一周</div>
          </el-divider>
          <div class="dietOn" v-for="item in diet_analysis_one" :key="item">
            <div class="time-botton">
              <img src="../../assets/img/evaluaction_service_icon.png" alt="" style="width:15px; height:15px;">
              {{ item.pName }}
            </div>
            <div class="plates">
              <div class="time-type time-left-color">早餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="breakfast in item.早餐" :key="breakfast"><img :src=" 'http://'+baseUrl+'/' + breakfast.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="earlier in item.早点" :key="earlier"><img :src="'http://'+baseUrl+'/' + earlier.meal_image" alt="" style="width:100px; height:100px;"></span>
                </div>
              </div>
              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>早餐7:00: <span v-for="breakfast in item.早餐" :key="breakfast"><o class="foodsNames">{{  breakfast.food_name }}</o> 重量:{{ breakfast.weight }}g; </span></div>
                <div>早点10:00: <span v-for="earlier in item.早点" :key="earlier"><o class="foodsNames">{{  earlier.food_name }}</o> 重量:{{ earlier.weight }}g; </span></div>
              </div>
            </div>

            <div class="plates">
              <div class="time-type time-common-color">午餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="lunch in item.午餐" :key="lunch"><img :src=" 'http://'+baseUrl+'/' + lunch.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="noon in item.午点" :key="noon"><img :src="'http://'+baseUrl+'/' + noon.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>

              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>午餐12:00: <span v-for="lunch in item.午餐" :key="lunch"><o class="foodsNames">{{  lunch.food_name }}</o> 重量:{{ lunch.weight }}g; </span></div>
                <div>午点15:00: <span v-for="noon in item.午点" :key="noon"><o class="foodsNames">{{  noon.food_name }}</o> 重量:{{ noon.weight }}g; </span></div>
              </div>
            </div>

            <div class="plates">
              <div class="time-type time-right-color">晚餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="dinner in item.晚餐" :key="dinner"><img :src=" 'http://'+baseUrl+'/' + dinner.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="late in item.晚点" :key="late"><img :src="'http://'+baseUrl+'/' + late.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>

              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>晚餐18:00: <span v-for="dinner in item.晚餐" :key="dinner"><o class="foodsNames">{{  dinner.food_name }}</o> 重量:{{ dinner.weight }}g; </span></div>
                <div>晚点21:00: <span v-for="late in item.晚点" :key="late"><o class="foodsNames">{{  late.food_name }}</o> 重量:{{ late.weight }}g; </span></div>
              </div>
            </div>
          </div>

          <div style="clear: both"></div>

          <el-divider  border-style="dashed"  style="border-color:#626aef;margin-top: 240px;">
            <div class="subTitle">第二周</div>
          </el-divider>
          <div class="dietOn" v-for="item in diet_analysis_two" :key="item">
            <div class="time-botton">
              <img src="../../assets/img/evaluaction_service_icon.png" alt="" style="width:15px; height:15px;">
              {{ item.pName }}
            </div>
            <div class="plates">
              <div class="time-type time-left-color">早餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="breakfast in item.早餐" :key="breakfast"><img :src=" 'http://'+baseUrl+'/' + breakfast.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="earlier in item.早点" :key="earlier"><img :src="'http://'+baseUrl+'/' + earlier.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>
              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>早餐7:00: <span v-for="breakfast in item.早餐" :key="breakfast"><o class="foodsNames">{{  breakfast.food_name }}</o> 重量:{{ breakfast.weight }}g; </span></div>
                <div>早点10:00: <span v-for="earlier in item.早点" :key="earlier"><o class="foodsNames">{{  earlier.food_name }}</o> 重量:{{ earlier.weight }}g; </span></div>
              </div>
            </div>

            <div class="plates">
              <div class="time-type time-common-color">午餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="lunch in item.午餐" :key="lunch"><img :src=" 'http://'+baseUrl+'/' + lunch.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="noon in item.午点" :key="noon"><img :src="'http://'+baseUrl+'/' + noon.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>

              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>午餐12:00: <span v-for="lunch in item.午餐" :key="lunch"><o class="foodsNames">{{  lunch.food_name }}</o> 重量:{{ lunch.weight }}g; </span></div>
                <div>午点15:00: <span v-for="noon in item.午点" :key="noon"><o class="foodsNames">{{  noon.food_name }}</o> 重量:{{ noon.weight }}g; </span></div>
              </div>
            </div>

            <div class="plates">
              <div class="time-type time-right-color">晚餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="dinner in item.晚餐" :key="dinner"><img :src=" 'http://'+baseUrl+'/' + dinner.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="late in item.晚点" :key="late"><img :src="'http://'+baseUrl+'/' + late.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>

              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>晚餐18:00: <span v-for="dinner in item.晚餐" :key="dinner"><o class="foodsNames">{{  dinner.food_name }}</o> 重量:{{ dinner.weight }}g; </span></div>
                <div>晚点21:00: <span v-for="late in item.晚点" :key="late"><o class="foodsNames">{{  late.food_name }}</o> 重量:{{ late.weight }}g; </span></div>
              </div>
            </div>
          </div>

          <div style="clear: both"></div>

          <el-divider  border-style="dashed"  style="border-color:#626aef;margin-top: 240px;">
            <div class="subTitle">第三周</div>
          </el-divider>
          <div class="dietOn" v-for="item in diet_analysis_three" :key="item">
            <div class="time-botton">
              <img src="../../assets/img/evaluaction_service_icon.png" alt="" style="width:15px; height:15px;">
              {{ item.pName }}
            </div>
            <div class="plates">
              <div class="time-type time-left-color">早餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="breakfast in item.早餐" :key="breakfast"><img :src=" 'http://'+baseUrl+'/' + breakfast.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="earlier in item.早点" :key="earlier"><img :src="'http://'+baseUrl+'/' + earlier.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>
              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>早餐7:00: <span v-for="breakfast in item.早餐" :key="breakfast"><o class="foodsNames">{{  breakfast.food_name }}</o> 重量:{{ breakfast.weight }}g; </span></div>
                <div>早点10:00: <span v-for="earlier in item.早点" :key="earlier"><o class="foodsNames">{{  earlier.food_name }}</o> 重量:{{ earlier.weight }}g; </span></div>
              </div>
            </div>

            <div class="plates">
              <div class="time-type time-common-color">午餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="lunch in item.午餐" :key="lunch"><img :src=" 'http://'+baseUrl+'/' + lunch.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="noon in item.午点" :key="noon"><img :src="'http://'+baseUrl+'/' + noon.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>

              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>午餐12:00: <span v-for="lunch in item.午餐" :key="lunch"><o class="foodsNames">{{  lunch.food_name }}</o> 重量:{{ lunch.weight }}g; </span></div>
                <div>午点15:00: <span v-for="noon in item.午点" :key="noon"><o class="foodsNames">{{  noon.food_name }}</o> 重量:{{ noon.weight }}g; </span></div>
              </div>
            </div>

            <div class="plates">
              <div class="time-type time-right-color">晚餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="dinner in item.晚餐" :key="dinner"><img :src=" 'http://'+baseUrl+'/' + dinner.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="late in item.晚点" :key="late"><img :src="'http://'+baseUrl+'/' + late.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>

              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>晚餐18:00: <span v-for="dinner in item.晚餐" :key="dinner"><o class="foodsNames">{{  dinner.food_name }}</o> 重量:{{ dinner.weight }}g; </span></div>
                <div>晚点21:00: <span v-for="late in item.晚点" :key="late"><o class="foodsNames">{{  late.food_name }}</o> 重量:{{ late.weight }}g; </span></div>
              </div>
            </div>
          </div>

          <div style="clear: both"></div>

          <el-divider  border-style="dashed"  style="border-color:#626aef;margin-top: 240px;">
            <div class="subTitle">第四周</div>
          </el-divider>
          <div class="dietOn" v-for="item in diet_analysis_four" :key="item">
            <div class="time-botton">
              <img src="../../assets/img/evaluaction_service_icon.png" alt="" style="width:15px; height:15px;">
              {{ item.pName }}
            </div>
            <div class="plates">
              <div class="time-type time-left-color">早餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="breakfast in item.早餐" :key="breakfast"><img :src=" 'http://'+baseUrl+'/' + breakfast.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="earlier in item.早点" :key="earlier"><img :src="'http://'+baseUrl+'/' + earlier.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>
              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>早餐7:00: <span v-for="breakfast in item.早餐" :key="breakfast"><o class="foodsNames">{{  breakfast.food_name }}</o> 重量:{{ breakfast.weight }}g; </span></div>
                <div>早点10:00: <span v-for="earlier in item.早点" :key="earlier"><o class="foodsNames">{{  earlier.food_name }}</o> 重量:{{ earlier.weight }}g; </span></div>
              </div>
            </div>

            <div class="plates">
              <div class="time-type time-common-color">午餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="lunch in item.午餐" :key="lunch"><img :src=" 'http://'+baseUrl+'/' + lunch.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="noon in item.午点" :key="noon"><img :src="'http://'+baseUrl+'/' + noon.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>

              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>午餐12:00: <span v-for="lunch in item.午餐" :key="lunch"><o class="foodsNames">{{  lunch.food_name }}</o> 重量:{{ lunch.weight }}g; </span></div>
                <div>午点15:00: <span v-for="noon in item.午点" :key="noon"><o class="foodsNames">{{  noon.food_name }}</o> 重量:{{ noon.weight }}g; </span></div>
              </div>
            </div>

            <div class="plates">
              <div class="time-type time-right-color">晚餐</div>
              <div class="der">
                <div style="margin-left:6%;padding-top: 6%;">
                  <span class="plates-top-img" v-for="dinner in item.晚餐" :key="dinner"><img :src=" 'http://'+baseUrl+'/' + dinner.meal_image" alt="" style="width:100%; height:100%;"></span>
                  <span class="plates-top-img" v-for="late in item.晚点" :key="late"><img :src="'http://'+baseUrl+'/' + late.meal_image" alt="" style="width:100%; height:100%;"></span>
                </div>
              </div>

              <div class="platesFoods">
                <div>大小：{{ item.multiple }}倍</div>
                <div>晚餐18:00: <span v-for="dinner in item.晚餐" :key="dinner"><o class="foodsNames">{{  dinner.food_name }}</o> 重量:{{ dinner.weight }}g; </span></div>
                <div>晚点21:00: <span v-for="late in item.晚点" :key="late"><o class="foodsNames">{{  late.food_name }}</o> 重量:{{ late.weight }}g; </span></div>
              </div>
            </div>
          </div>

        </el-card>
  </div>

</template>

<script setup>
import {defineComponent, onMounted, ref, watch, reactive} from 'vue';
import {ElMessage} from "element-plus";
import * as api from "../../api/loginHttp";
import http, {baseUrl} from "../../utils/http";
import Header from '../common/Header.vue';
import Drawer from '../common/Drawer.vue';
import CompanyChildDiet from '../common/CompanyChilddiet.vue';
import CompanyChilddietary from '../common/CompanyChilddietary.vue';

import {useRoute, useRouter} from "vue-router"
const route = useRoute()
const router = useRouter()
const groupId = ref()
const reportId = ref()
const labName = ref()
const id = ref()
const imgUrl = ref()
const formInline = ref({})
const diet_analysis_one = ref({})
const diet_analysis_two = ref({})
const diet_analysis_three = ref({})
const diet_analysis_four = ref({})
const diet_analysis = ref({})
const report_time  = ref()
const types = ref(['团体信息', '早餐', '午餐', '晚餐', '第一周', '第二周', '第三周', '第四周'])
const typeActive = ref(-1)
const form = ref({
  elText:'',
  elTextTwo:'',
  elTextThree:'',
})
import PrintJS from 'print-js'

const fetchData = async () => {
  if (route.params.groupId) {
    groupId.value = route.params.groupId
    id.value = route.params.id
    reportId.value = route.params.reportId
    if(groupId.value == 3) {
      labName.value = '婴幼儿营养测评'
    } else if(groupId.value == 5) {
      labName.value = '孕产妇营养测评'
    } else if(groupId.value == 6) {
      labName.value = '成年人营养测评'
    } else if(groupId.value == 7) {
      labName.value = '慢性病营养测评'
    } else if (groupId.value == 8) {
      labName.value = '团体营养测评'
    } else {
      labName.value = '婴幼儿营养测评'
    }
    imgUrl.value = "http://"+baseUrl+'/';
  } else {
    ElMessage.error('栏目编号不得为空')
    await router.push({'path': '/Home'})
  }


  http.get('api/company/CompanyRportInfo?id='+ reportId.value).then((res)=>{

    report_time.value = res.data.data.createtime
    if(res.data.code === 1) {
      res.data.data.id = id
      formInline.value = res.data.data

      for(let i = 0; i< res.data.data.diet_analysis_1.length; i++) {
        switch (i){
          case 0:
            res.data.data.diet_analysis_1[i]['pName'] = '周一';
            break
          case 1:
            res.data.data.diet_analysis_1[i]['pName'] = '周二';
            break
          case 2:
            res.data.data.diet_analysis_1[i]['pName'] = '周三';
            break
          case 3:
            res.data.data.diet_analysis_1[i]['pName'] = '周四';
            break
          case 4:
            res.data.data.diet_analysis_1[i]['pName'] = '周五';
            break
        }
      }
      diet_analysis_one.value = res.data.data.diet_analysis_1;

      for(let i = 0; i< res.data.data.diet_analysis_2.length; i++) {
        switch (i){
          case 0:
            res.data.data.diet_analysis_2[i]['pName'] = '周一';
            break
          case 1:
            res.data.data.diet_analysis_2[i]['pName'] = '周二';
            break
          case 2:
            res.data.data.diet_analysis_2[i]['pName'] = '周三';
            break
          case 3:
            res.data.data.diet_analysis_2[i]['pName'] = '周四';
            break
          case 4:
            res.data.data.diet_analysis_2[i]['pName'] = '周五';
            break
        }
      }
      diet_analysis_two.value = res.data.data.diet_analysis_2;

      for(let i = 0; i< res.data.data.diet_analysis_3.length; i++) {
        switch (i){
          case 0:
            res.data.data.diet_analysis_3[i]['pName'] = '周一';
            break
          case 1:
            res.data.data.diet_analysis_3[i]['pName'] = '周二';
            break
          case 2:
            res.data.data.diet_analysis_3[i]['pName'] = '周三';
            break
          case 3:
            res.data.data.diet_analysis_3[i]['pName'] = '周四';
            break
          case 4:
            res.data.data.diet_analysis_3[i]['pName'] = '周五';
            break
        }
      }
      diet_analysis_three.value = res.data.data.diet_analysis_3;

      for(let i = 0; i< res.data.data.diet_analysis_4.length; i++) {
        switch (i){
          case 0:
            res.data.data.diet_analysis_4[i]['pName'] = '周一';
            break
          case 1:
            res.data.data.diet_analysis_4[i]['pName'] = '周二';
            break
          case 2:
            res.data.data.diet_analysis_4[i]['pName'] = '周三';
            break
          case 3:
            res.data.data.diet_analysis_4[i]['pName'] = '周四';
            break
          case 4:
            res.data.data.diet_analysis_4[i]['pName'] = '周五';
            break
        }
      }
      diet_analysis_four.value = res.data.data.diet_analysis_4;

      if(res.data.data.feed_advice != '' && res.data.data.feed_advice != null) {
        form.value.elText = res.data.data.feed_advice;
      } else {
        form.value.elText = '当膳食方案中有食谱或食材不符合您的膳食习惯时，请先与医生确认，若医生认为某些食材对儿童的膳食营养改善很重要，要求不能置换或最好不要置换；其他类可进行同类食材替换，例如：猪肉、牛肉、羊肉之间可互换，鸡肉、鸭肉、鱼类之间可互换，蔬菜间可互换，米面间可互换，但要注意不要更改食材用量。\n' +
            '给儿童烹调食物时，宜尽可能保持食物的原味，口味以清淡为宜，少放调料。\n' +
            '每天应当进行至少1小时的户外游戏或运动，每天看电视、玩平板电脑的累计时间不超过2小时，日常生活中还可适当增加一些有氧活动例如：自行车、慢跑、跳绳、仰卧起坐、游泳等。';
      }

      if(res.data.data.nutrition_advice != '' && res.data.data.nutrition_advice != null) {
        form.value.elTextTwo = res.data.data.nutrition_advice;
      } else {
        form.value.elTextTwo = '这个阶段是饮食行为和生活方式形成的关键时期，7岁前的儿童生活自理能力不断提高，自主性、好奇心、学习能力和模仿能力增强，该时期也是培养良好饮食习惯的重要阶段。\n' +
            '家长要有意识的培养孩子规律就餐，每天的饮食种类应该包含谷、肉、蛋、菜、奶、水果，自主进食不挑食的饮食习惯。';
        if(contents._rawValue.hair_value !='' || contents._rawValue.oralCavity_value != '' || contents._rawValue.neck_value != '' || contents._rawValue.Neuropathy_value != '' || contents._rawValue.symptoms_value != '') {
          form.value.elTextTwo = '这个阶段是饮食行为和生活方式形成的关键时期，7岁前的儿童生活自理能力不断提高，自主性、好奇心、学习能力和模仿能力增强，该时期也是培养良好饮食习惯的重要阶段。\n' +
              '家长要有意识的培养孩子规律就餐，每天的饮食种类应该包含谷、肉、蛋、菜、奶、水果，自主进食不挑食的饮食习惯。';
        } else if(contents._rawValue.eye_value !='' ) {
          form.value.elTextTwo = '平衡膳食，多摄入动物肝、肾、奶、蛋和深绿或红黄蔬菜、水果等富维生素A和β胡萝卜素食物。婴儿要及时添加含动物肝等辅食，没有母乳的婴儿需配方奶喂养。生后及时按预防量补充维生素A。幼儿膳食中要注意脂肪和含维生素A和β胡萝卜素食物搭配食用。患消化系统疾病及消耗性疾病的患儿需及时补充维生素A制剂。\n' +
              '长期摄入不足是导致维生素A缺乏的主要原因，儿童维生素A的主要来自1、肝脏、鱼油、奶制品、鸡蛋等动物性食物；2、绿叶蔬菜以及黄色或橙色的水果和蔬菜中富含各种胡罗卜素，可在体内转变为维生素A。对于人体来说，动物性食物中的VA要比植物性中的VA更容易吸收。';
        } else if(contents._rawValue.skin_value !='' ) {
          form.value.elTextTwo = '谷类、硬果、动物内脏、蛋类及酵母中维生素B1含量丰富，但需要注意谷类加工过度可损失维生素B1，以及生鱼和贝类含有破坏维生素B1的酶，所以在日常饮食中不长期食用精米、生鱼和贝类。还需要注意的是维生素B1易溶于水，在碱性条件下易受热破坏，所以过分淘米或烹调中加碱也可导致维生素B1大量损失。\n' +
              '富含维生素B2的食物主要是动物肝脏（如肝、肾、心）等、蛋黄和乳类。谷类的精细加工会导致所含的维生素B2流失，所以儿童日常饮食中还需要增加粗粮的比例以及保证每日鸡蛋和牛奶的摄入。';
        } else if(contents._rawValue.sign_value !='' ) {
          form.value.elTextTwo = '足量的食物，平衡膳食，规律就餐，不偏食不挑食，每天饮奶多喝水，避免含糖饮料，是保障儿童生长发育的关键。日常生活中选择健康有营养的零食，避免含糖饮料和高脂肪的油炸食物，导致儿童正餐不按量食用。\n' +
              '营养不良的儿童，要在保证能量摄入充足的基础上，增加鱼、禽、蛋、瘦肉、豆制品等富含优质蛋白质的食物的摄入，经常使用奶及奶制品，每天吃新鲜的蔬菜水果；保证一日三餐，纠正偏食和过度节食等不健康饮食行为，并保持适宜的身体活动。';
        } else if(contents._rawValue.sign_value !='') {
          form.value.elTextTwo = '奶和奶制品是儿童钙的主要来源，也是最佳来源。绿色蔬菜、大豆及其制品特殊含有较高的钙，可作为补充来源。 需要特别注意的是钙在体内主动吸收需要维生素D，维生素D缺乏或不足时，钙主动吸收下降间接造成改缺乏。此外，运动锻炼也是骨骼健康的重要决定因素，跑、跳等中等程度的运动有利于骨骼钙沉积，达到更高的估量峰值。'
        }
      }

      form.value.elTextThree = res.data.data.doctor_advice;


    } else {
      ElMessage.error('数据获取失败')
      router.push({'path': '/pageList/' + groupId.value})
    }

  })

  setTimeout(() => {
    print('print-all')
  }, 2000)
}
const onClickPrint = () => {
  let printParam = '';

  if (typeActive.value === '全部') {
    let PrintAll = router.resolve({
      path:  "/PrintAll/"+groupId.value+"/"+id.value+"/"+reportId.value
    });
    window.open(PrintAll.href, "_blank");
  } else {

    switch (typeActive.value){
      case '基本信息':
        let PrintMember = router.resolve({
          path:  "/PrintMember/"+groupId.value+"/"+id.value+"/"+reportId.value
        });
        window.open(PrintMember.href, "_blank");
        break
      case '体成分分析':
        let PrintAnalysis = router.resolve({
          path:  "/PrintAnalysis/"+groupId.value+"/"+id.value+"/"+reportId.value
        });
        window.open(PrintAnalysis.href, "_blank");
        break
      case '膳食分析':
        let PrintComposition = router.resolve({
          path:  "/PrintComposition/"+groupId.value+"/"+id.value+"/"+reportId.value
        });
        window.open(PrintComposition.href, "_blank");
        break
      case '历史曲线图':
        let PrintDiagram = router.resolve({
          path:  "/PrintDiagram/"+groupId.value+"/"+id.value+"/"+reportId.value
        });
        window.open(PrintDiagram.href, "_blank");
        break
    }

    // print(typeActive.value)
  }
}

const  onKeep = async () =>{
  let params = form._rawValue
  params['reportId'] = reportId.value
  const res = await api.setCompanyAdvice(params);
  if(res.data.code === 1) {
    ElNotification({
      title: '建议保存成功',
      message: res.data.msg,
      type: 'success',
    })
    return false;
  } else {
    ElNotification({
      title: '建议保存失败',
      message: res.data.msg,
      type: 'error',
    })
    return false;
  }
}

const pageList = async () => {
  await router.push({'path': '/CompanyList/' + id.value})
}


onMounted(() => {
  fetchData()
})
</script>

<style scoped>
.right-box-card {
  width: 100%;
  margin-left: 0%;
}
.el-card.is-always-shadow {
  box-shadow: none;
}

.el-card {
  border: none;
}

#basic .title {
  font-size: 36px;
  width: 100%;
  text-align: center;
  height: 100px;
  margin-top:100px;
}
#basic #createTime {
  font-size: 16px;
  color:#999999;
  margin-left: 70%;
}
.subTitle {
  font-size: 30px;
  text-align: center;
  height: 40px;
  color: #626aef;
  /*border-bottom: 1px dashed  red;*/
}


.every {
  height: 55px;
  line-height: 55px;
  width: 23%;
  float: left;
  margin-left: 10%;
  font-weight: bold;
}

.right-box-card {
  width: 100%;
  margin-left: 0%;
}

.dietOn {
  height: 500px;
}

.plates {
  width: 33%;
  float: left;
}

.time-type {
  width: 58px;
  height: 58px;
  line-height: 58px;
  text-align: center;
  background: #85CE61;
  border-radius: 50%;
  opacity: 1;
  color: #fff;
  box-shadow: 5px 5px 2px #888888;
  margin: 20px 0 20px 40%;
}
.time-left-color {
  background: #85CE61;
}

.time-common-color {
  background: #E8B973;
}

.time-right-color {
  background: #6EA9E0;
}
.der{
  width: 320px;
  height: 217px;
  background: url("../../assets/img/evaluaction_service_plate.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.plates .plates-top-img {
  float: left;
  margin-left: 1%;
  width: 30%;
}

.time-botton {
  background-color: #626aef;
  width: 108px;
  height: 41px;
  color: #fff;
  font-size: 16px;
  border-radius: 100px;
  line-height: 41px;
  margin: 40px 0 0 40px;
  text-align: center;
}

.foodsNames {
  color:red;
}

.platesFoods{
  margin-top: 5px;
  margin-left: 8px;
  color: #333333;
  font-size: 16px;
}

.params{
  width: 100%;
  font-size: 22px;
  font-weight: bold;
}

.shu {
  width: 5px;
  height: 30px;
  background: #626aef;
  opacity: 1;
  border-radius: 100px;
  float: left;
  margin-right: 2%;
  margin-left: 5%;
}

::v-deep .el-textarea {
  width: 80%;
  margin-left: 70px;
}

::v-deep .el-textarea__inner {
  width: 946px;
  height: 157px;
  border-radius: 30px;
  border: 1px solid #626aef;
}
</style>
